<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="layui-v2.8.2/dist/css/layui.css"/>
</head>
<body>
<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form" action="data/post.json" lay-filter="demo1">
            <div class="layui-form-item">
                <label class="layui-form-label">验证必填项</label>
                <div class="layui-input-block">
                    <input type="text" name="username" lay-verify="required" placeholder="请输入" autocomplete="off" value="1111"
                           class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layer-footer layui-hide">
                    <button class="layui-btn btn-submit">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- 依 赖 脚 本 -->
<script src="layui-v2.8.2/dist/layui.js"></script>
<script src="js/common.js"></script>
<script>
    layui.use(['form', 'layuiFastHelper'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let layuiFastHelper = layui.layuiFastHelper;
        // 提交事件
        $('.btn-submit').on('click', function(){
            form.submit('demo1', function(data){
                layuiFastHelper.http('post', data.form.action, data.field).then(function () {
                    layuiFastHelper.close();
                });
            });
            return false;
        });
    });

</script>
</body>
</html>